package com.szcinda.repository;

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Entity;
import java.time.LocalDate;

@EqualsAndHashCode(callSuper = true)
@Data
@Entity
public class GhOrder extends BaseEntity {
    private String clientId;
    private String clientName;
    private String orderNumber;
    private LocalDate pickDate;
    private String bookNumber;
    private String originPlace;
    private String destPlace;
    private int quantity;
    private String currency;
    private double squareNumber;
    private double grossWeight;
    private double volumeWeight;
    private LocalDate actDepartureTime;
    private LocalDate receiveDate;
    private String deliveryModel;
    private String deliveryModelRemark; // 派送备注
    private double deliveryModelFee;   // 运输费
    private String calculateType;
    private String carrierId;
    private String carrierName;
    private String userId;
    private String userName;
    private String organizationId;
    private String organizationName;
    private String carrierDeparturePort;
    private String invoice = BillType.STATUS_WKP;
    private String settlement = BillType.STATUS_WJS;
    private String outInvoice = BillType.STATUS_WKP;
    private String outSettlement = BillType.STATUS_WJS;
    private double pb;
    private String remark;
    private String billRemark;// 账单备注

    private String businessCode;

    private String status; // 订单状态


    private String vehicleType;// 提货车型
    private String vehicleLine;// 提货线路
    private String deliveryLine;// 派送线路

    public void checkCanLock() {
        if ((BillType.STATUS_YKP.equals(this.invoice) && BillType.STATUS_YJS.equals(this.settlement)) || (BillType.STATUS_YKP.equals(this.outInvoice) && BillType.STATUS_YJS.equals(this.outSettlement))) {
            this.setStatus(OrderStatus.CONFIRMED);
        }
    }
}
